using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.IO;

namespace MH.WsdlWorks.ProjectModel
{
    [XmlRoot()]
    public class WsdlProject : INode
    {
        string path;
        List<Wsdl> wsdls = new List<Wsdl>();
        [XmlArray]
        public List<Wsdl> Wsdls
        {
            get { return wsdls; }
            set { wsdls = value; }
        }

        string someText;
        [XmlElement]
        public string SomeText
        {
            get { return this.someText; }
            set { this.someText = value; }
        }

        string INode.GetPath()
        {
            return this.path;
        }

        public void SetParent(INode parent)
        {
            // we ignore the parent here because we are the root node
            foreach (Wsdl wsdl in this.wsdls)
            {
                wsdl.SetParent(this);
            }
        }

        public void SetPath(string path)
        {
            this.path = Path.GetDirectoryName(path);
        }
    }
}
